Update to rust master
authorAlex Crichton <alex@alexcrichton.com>
Sun, 21 Sep 2014 16:27:08 +0000 (09:27 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Sun, 21 Sep 2014 17:19:18 +0000 (10:19 -0700)
Cargo.lock
src/cargo/core/shell.rs
src/cargo/ops/cargo_generate_lockfile.rs
src/cargo/ops/cargo_rustc/context.rs
src/cargo/ops/cargo_rustc/mod.rs
src/cargo/util/config.rs
src/cargo/util/toml.rs

index feb5c8008b918369e9d16524167a89667e1a1ec8..f9b5b57a4c8464ea313d4934dba23b540ca24f4f 100644 (file)
@@ -3,16 +3,16 @@ name = "cargo"
 version = "0.0.1-pre"
 dependencies = [
  "curl 0.0.1 (git+https://github.com/alexcrichton/curl-rust?ref=bundle#720d87fa32c738c397252cf3c26d428bdca697d4)",
- "docopt 0.6.3 (git+https://github.com/docopt/docopt.rs#ee3844098f213121ce7dfb32cdbf2512ecba7085)",
- "docopt_macros 0.6.3 (git+https://github.com/docopt/docopt.rs#ee3844098f213121ce7dfb32cdbf2512ecba7085)",
+ "docopt 0.6.3 (git+https://github.com/docopt/docopt.rs#ca5a09aba10c5040220efe9d237a430f3b924736)",
+ "docopt_macros 0.6.3 (git+https://github.com/docopt/docopt.rs#ca5a09aba10c5040220efe9d237a430f3b924736)",
  "flate2 0.0.1 (git+https://github.com/alexcrichton/flate2-rs#a59b2a103642550bc1500c302c5031479ec7d9e1)",
- "git2 0.0.1 (git+https://github.com/alexcrichton/git2-rs#05276ae6dce9d3945104ffefb9e1496323351398)",
+ "git2 0.0.1 (git+https://github.com/alexcrichton/git2-rs#08dc5e62bf11ff8957fcb98c0c3c57c764fc4879)",
  "glob 0.0.1 (git+https://github.com/rust-lang/glob#ce24c37f268c4a31238dbe3b8e9ff8fe5342f0be)",
  "hamcrest 0.1.0 (git+https://github.com/carllerche/hamcrest-rust.git#49061a2134d9112b8622d54587590f324b97cc98)",
  "semver 0.0.1 (git+https://github.com/rust-lang/semver#df163f7b22686493b037eee1f1f9d1a2742f9bbe)",
  "tar 0.0.1 (git+https://github.com/alexcrichton/tar-rs#b2391703d54afd20c999d5531c4ed46bcf366f23)",
- "toml 0.1.0 (git+https://github.com/alexcrichton/toml-rs#5f5bd93203aa4c8e0602eb4def2d73d385cba74c)",
- "url 0.1.0 (git+https://github.com/servo/rust-url#bfdf809365600a7941a77524f9bb065886de3379)",
+ "toml 0.1.0 (git+https://github.com/alexcrichton/toml-rs#22ad6e7ea9f2a81aac3ba9e427dd8a1036453486)",
+ "url 0.1.0 (git+https://github.com/servo/rust-url#275c4a8e1926ab87247203817c9c812e9b83a49f)",
 ]
 
 [[package]]
@@ -22,7 +22,7 @@ source = "git+https://github.com/alexcrichton/curl-rust?ref=bundle#720d87fa32c73
 dependencies = [
  "curl-sys 0.0.1 (git+https://github.com/alexcrichton/curl-rust?ref=bundle#720d87fa32c738c397252cf3c26d428bdca697d4)",
  "link-config 0.0.1 (git+https://github.com/alexcrichton/link-config#1d3cd271612036b47c015a55f33a97e1524569ae)",
- "url 0.1.0 (git+https://github.com/servo/rust-url#bfdf809365600a7941a77524f9bb065886de3379)",
+ "url 0.1.0 (git+https://github.com/servo/rust-url#275c4a8e1926ab87247203817c9c812e9b83a49f)",
 ]
 
 [[package]]
@@ -33,20 +33,20 @@ source = "git+https://github.com/alexcrichton/curl-rust?ref=bundle#720d87fa32c73
 [[package]]
 name = "docopt"
 version = "0.6.3"
-source = "git+https://github.com/docopt/docopt.rs#ee3844098f213121ce7dfb32cdbf2512ecba7085"
+source = "git+https://github.com/docopt/docopt.rs#ca5a09aba10c5040220efe9d237a430f3b924736"
 
 [[package]]
 name = "docopt_macros"
 version = "0.6.3"
-source = "git+https://github.com/docopt/docopt.rs#ee3844098f213121ce7dfb32cdbf2512ecba7085"
+source = "git+https://github.com/docopt/docopt.rs#ca5a09aba10c5040220efe9d237a430f3b924736"
 dependencies = [
- "docopt 0.6.3 (git+https://github.com/docopt/docopt.rs#ee3844098f213121ce7dfb32cdbf2512ecba7085)",
+ "docopt 0.6.3 (git+https://github.com/docopt/docopt.rs#ca5a09aba10c5040220efe9d237a430f3b924736)",
 ]
 
 [[package]]
 name = "encoding"
 version = "0.1.0"
-source = "git+https://github.com/lifthrasiir/rust-encoding#35f0d70f65f73ba16f296f9ec675eddee661ba79"
+source = "git+https://github.com/lifthrasiir/rust-encoding#28eafb604a92c7786685b46c0fc02682ba3ab265"
 
 [[package]]
 name = "flate2"
@@ -56,10 +56,10 @@ source = "git+https://github.com/alexcrichton/flate2-rs#a59b2a103642550bc1500c30
 [[package]]
 name = "git2"
 version = "0.0.1"
-source = "git+https://github.com/alexcrichton/git2-rs#05276ae6dce9d3945104ffefb9e1496323351398"
+source = "git+https://github.com/alexcrichton/git2-rs#08dc5e62bf11ff8957fcb98c0c3c57c764fc4879"
 dependencies = [
- "libgit2 0.0.1 (git+https://github.com/alexcrichton/git2-rs#05276ae6dce9d3945104ffefb9e1496323351398)",
- "url 0.1.0 (git+https://github.com/servo/rust-url#bfdf809365600a7941a77524f9bb065886de3379)",
+ "libgit2 0.0.1 (git+https://github.com/alexcrichton/git2-rs#08dc5e62bf11ff8957fcb98c0c3c57c764fc4879)",
+ "url 0.1.0 (git+https://github.com/servo/rust-url#275c4a8e1926ab87247203817c9c812e9b83a49f)",
 ]
 
 [[package]]
@@ -75,7 +75,7 @@ source = "git+https://github.com/carllerche/hamcrest-rust.git#49061a2134d9112b86
 [[package]]
 name = "libgit2"
 version = "0.0.1"
-source = "git+https://github.com/alexcrichton/git2-rs#05276ae6dce9d3945104ffefb9e1496323351398"
+source = "git+https://github.com/alexcrichton/git2-rs#08dc5e62bf11ff8957fcb98c0c3c57c764fc4879"
 dependencies = [
  "libssh2-static-sys 0.0.1 (git+https://github.com/alexcrichton/libssh2-static-sys#6a5d3ad7b62db6ca0721c528402f4976a1876036)",
  "link-config 0.0.1 (git+https://github.com/alexcrichton/link-config#1d3cd271612036b47c015a55f33a97e1524569ae)",
@@ -110,13 +110,13 @@ source = "git+https://github.com/alexcrichton/tar-rs#b2391703d54afd20c999d5531c4
 [[package]]
 name = "toml"
 version = "0.1.0"
-source = "git+https://github.com/alexcrichton/toml-rs#5f5bd93203aa4c8e0602eb4def2d73d385cba74c"
+source = "git+https://github.com/alexcrichton/toml-rs#22ad6e7ea9f2a81aac3ba9e427dd8a1036453486"
 
 [[package]]
 name = "url"
 version = "0.1.0"
-source = "git+https://github.com/servo/rust-url#bfdf809365600a7941a77524f9bb065886de3379"
+source = "git+https://github.com/servo/rust-url#275c4a8e1926ab87247203817c9c812e9b83a49f"
 dependencies = [
- "encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding#35f0d70f65f73ba16f296f9ec675eddee661ba79)",
+ "encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding#28eafb604a92c7786685b46c0fc02682ba3ab265)",
 ]
 
index 9c741e1ab1ff477191871531ae38f85a207f907e..f1c71f47ec7eb426928cd3b3a361bdd7fb2744ce 100644 (file)
@@ -12,7 +12,7 @@ pub struct ShellConfig {
 
 enum AdequateTerminal<'a> {
     NoColor(Box<Writer+'a>),
-    Color(Box<Terminal<Box<Writer+'a>>+'a>)
+    Colored(Box<Terminal<Box<Writer+'a>>+'a>)
 }
 
 pub struct Shell<'a> {
@@ -79,7 +79,7 @@ impl<'a> Shell<'a> {
         if config.tty && config.color {
             let term: Option<term::TerminfoTerminal<Box<Writer+'a>>> = Terminal::new(out);
             term.map(|t| Shell {
-                terminal: Color(box t as Box<Terminal<Box<Writer+'a>>>),
+                terminal: Colored(box t as Box<Terminal<Box<Writer+'a>>>),
                 config: config
             }).unwrap_or_else(|| {
                 Shell { terminal: NoColor(box stderr() as Box<Writer+'a>), config: config }
@@ -135,35 +135,35 @@ impl<'a> Terminal<Box<Writer+'a>> for Shell<'a> {
 
     fn fg(&mut self, color: color::Color) -> IoResult<bool> {
         match self.terminal {
-            Color(ref mut c) => c.fg(color),
+            Colored(ref mut c) => c.fg(color),
             NoColor(_) => Ok(false)
         }
     }
 
     fn bg(&mut self, color: color::Color) -> IoResult<bool> {
         match self.terminal {
-            Color(ref mut c) => c.bg(color),
+            Colored(ref mut c) => c.bg(color),
             NoColor(_) => Ok(false)
         }
     }
 
     fn attr(&mut self, attr: Attr) -> IoResult<bool> {
         match self.terminal {
-            Color(ref mut c) => c.attr(attr),
+            Colored(ref mut c) => c.attr(attr),
             NoColor(_) => Ok(false)
         }
     }
 
     fn supports_attr(&self, attr: Attr) -> bool {
         match self.terminal {
-            Color(ref c) => c.supports_attr(attr),
+            Colored(ref c) => c.supports_attr(attr),
             NoColor(_) => false
         }
     }
 
     fn reset(&mut self) -> IoResult<()> {
         match self.terminal {
-            Color(ref mut c) => c.reset(),
+            Colored(ref mut c) => c.reset(),
             NoColor(_) => Ok(())
         }
     }
@@ -174,14 +174,14 @@ impl<'a> Terminal<Box<Writer+'a>> for Shell<'a> {
 
     fn get_ref<'b>(&'b self) -> &'b Box<Writer+'a> {
         match self.terminal {
-            Color(ref c) => c.get_ref(),
+            Colored(ref c) => c.get_ref(),
             NoColor(ref w) => w
         }
     }
 
     fn get_mut<'b>(&'b mut self) -> &'b mut Box<Writer+'a> {
         match self.terminal {
-            Color(ref mut c) => c.get_mut(),
+            Colored(ref mut c) => c.get_mut(),
             NoColor(ref mut w) => w
         }
     }
@@ -190,14 +190,14 @@ impl<'a> Terminal<Box<Writer+'a>> for Shell<'a> {
 impl<'a> Writer for Shell<'a> {
     fn write(&mut self, buf: &[u8]) -> IoResult<()> {
         match self.terminal {
-            Color(ref mut c) => c.write(buf),
+            Colored(ref mut c) => c.write(buf),
             NoColor(ref mut n) => n.write(buf)
         }
     }
 
     fn flush(&mut self) -> IoResult<()> {
         match self.terminal {
-            Color(ref mut c) => c.flush(),
+            Colored(ref mut c) => c.flush(),
             NoColor(ref mut n) => n.flush()
         }
     }
index 3ec6560b78cab297e50703afc257dd806f816265..44b281289df7e99b338a2c10ab907c241093f5a2 100644 (file)
@@ -127,7 +127,7 @@ pub fn write_resolve(pkg: &Package, resolve: &Resolve) -> CargoResult<()> {
     Ok(())
 }
 
-fn emit_package(dep: &toml::Table, out: &mut String) {
+fn emit_package(dep: &toml::TomlTable, out: &mut String) {
     out.push_str(format!("name = {}\n", lookup(dep, "name")).as_slice());
     out.push_str(format!("version = {}\n", lookup(dep, "version")).as_slice());
 
@@ -151,6 +151,6 @@ fn emit_package(dep: &toml::Table, out: &mut String) {
     });
 }
 
-fn lookup<'a>(table: &'a toml::Table, key: &str) -> &'a toml::Value {
+fn lookup<'a>(table: &'a toml::TomlTable, key: &str) -> &'a toml::Value {
     table.find(&key.to_string()).expect(format!("Didn't find {}", key).as_slice())
 }
index 8307ed0cdcc356e18de5c34c4b4cd97736b6ae70..4b3531cd1d8bef6035de9b3d42f0039122199d22 100644 (file)
@@ -10,9 +10,9 @@ use super::layout::{Layout, LayoutProxy};
 
 #[deriving(Show)]
 pub enum PlatformRequirement {
-    Target,
-    Plugin,
-    PluginAndTarget,
+    PlatformTarget,
+    PlatformPlugin,
+    PlatformPluginAndTarget,
 }
 
 pub struct Context<'a, 'b> {
@@ -148,7 +148,8 @@ impl<'a, 'b> Context<'a, 'b> {
 
         let targets = pkg.get_targets().iter();
         for target in targets.filter(|t| t.get_profile().is_compile()) {
-            self.build_requirements(pkg, target, Target, &mut HashSet::new());
+            self.build_requirements(pkg, target, PlatformTarget,
+                                    &mut HashSet::new());
         }
 
         self.compilation.extra_env.insert("NUM_JOBS".to_string(),
@@ -165,7 +166,7 @@ impl<'a, 'b> Context<'a, 'b> {
         if !visiting.insert(pkg.get_package_id()) { return }
 
         let key = (pkg.get_package_id(), target.get_name());
-        let req = if target.get_profile().is_plugin() {Plugin} else {req};
+        let req = if target.get_profile().is_plugin() {PlatformPlugin} else {req};
         self.requirements.insert_or_update_with(key, req, |_, v| {
             *v = v.combine(req);
         });
@@ -180,7 +181,7 @@ impl<'a, 'b> Context<'a, 'b> {
     pub fn get_requirement(&self, pkg: &'a Package,
                            target: &'a Target) -> PlatformRequirement {
         self.requirements.find(&(pkg.get_package_id(), target.get_name()))
-            .map(|a| *a).unwrap_or(Target)
+            .map(|a| *a).unwrap_or(PlatformTarget)
     }
 
     /// Switch this context over to being the primary compilation unit,
@@ -291,9 +292,9 @@ impl<'a, 'b> Context<'a, 'b> {
 impl PlatformRequirement {
     fn combine(self, other: PlatformRequirement) -> PlatformRequirement {
         match (self, other) {
-            (Target, Target) => Target,
-            (Plugin, Plugin) => Plugin,
-            _ => PluginAndTarget,
+            (PlatformTarget, PlatformTarget) => PlatformTarget,
+            (PlatformPlugin, PlatformPlugin) => PlatformPlugin,
+            _ => PlatformPluginAndTarget,
         }
     }
 }
index 40e58cdacd6bc58646c23b356c22e75115e94dc3..f79329639d11884cbb994c987321fb9b5ba83ba3 100644 (file)
@@ -11,7 +11,8 @@ use util::{Config, internal, ChainError, Fresh, profile};
 use self::job::{Job, Work};
 use self::job_queue::{JobQueue, StageStart, StageCustomBuild, StageLibraries};
 use self::job_queue::{StageBinaries, StageEnd};
-use self::context::{Context, PlatformRequirement, Target, Plugin, PluginAndTarget};
+use self::context::{Context, PlatformRequirement, PlatformTarget};
+use self::context::{PlatformPlugin, PlatformPluginAndTarget};
 
 pub use self::compilation::Compilation;
 
@@ -275,12 +276,12 @@ fn prepare_rustc(package: &Package, target: &Target, crate_types: Vec<&str>,
                                           KindPlugin));
 
     Ok(match req {
-        Target => vec![(target_cmd, KindTarget)],
-        Plugin => vec![(plugin_cmd, KindPlugin)],
-        PluginAndTarget if cx.config.target().is_none() =>
+        PlatformTarget => vec![(target_cmd, KindTarget)],
+        PlatformPlugin => vec![(plugin_cmd, KindPlugin)],
+        PlatformPluginAndTarget if cx.config.target().is_none() =>
             vec![(target_cmd, KindTarget)],
-        PluginAndTarget => vec![(target_cmd, KindTarget),
-                                (plugin_cmd, KindPlugin)],
+        PlatformPluginAndTarget => vec![(target_cmd, KindTarget),
+                                        (plugin_cmd, KindPlugin)],
     })
 }
 
index b780d94353b1303b2cdff0d0d323c6ee41cbfbdf..6c2918ade109672f76c36b6e9bcf4136d7548a99 100644 (file)
@@ -1,6 +1,8 @@
 use std::{fmt, os, result, mem};
 use std::io::fs::{PathExtensions, File};
 use std::collections::HashMap;
+use std::string;
+
 use serialize::{Encodable,Encoder};
 use toml;
 use core::MultiShell;
@@ -12,15 +14,15 @@ pub struct Config<'a> {
     home_path: Path,
     shell: &'a mut MultiShell<'a>,
     jobs: uint,
-    target: Option<String>,
-    linker: Option<String>,
-    ar: Option<String>,
+    target: Option<string::String>,
+    linker: Option<string::String>,
+    ar: Option<string::String>,
 }
 
 impl<'a> Config<'a> {
     pub fn new<'a>(shell: &'a mut MultiShell,
                    jobs: Option<uint>,
-                   target: Option<String>) -> CargoResult<Config<'a>> {
+                   target: Option<string::String>) -> CargoResult<Config<'a>> {
         if jobs == Some(0) {
             return Err(human("jobs must be at least 1"))
         }
@@ -71,9 +73,9 @@ impl<'a> Config<'a> {
         self.target.as_ref().map(|t| t.as_slice())
     }
 
-    pub fn set_ar(&mut self, ar: String) { self.ar = Some(ar); }
+    pub fn set_ar(&mut self, ar: string::String) { self.ar = Some(ar); }
 
-    pub fn set_linker(&mut self, linker: String) { self.linker = Some(linker); }
+    pub fn set_linker(&mut self, linker: string::String) { self.linker = Some(linker); }
 
     pub fn linker(&self) -> Option<&str> {
         self.linker.as_ref().map(|t| t.as_slice())
@@ -91,9 +93,9 @@ pub enum Location {
 
 #[deriving(Eq,PartialEq,Clone,Decodable)]
 pub enum ConfigValue {
-    String(String, Path),
-    List(Vec<(String, Path)>),
-    Table(HashMap<String, ConfigValue>),
+    String(string::String, Path),
+    List(Vec<(string::String, Path)>),
+    Table(HashMap<string::String, ConfigValue>),
     Boolean(bool, Path),
 }
 
@@ -122,7 +124,7 @@ impl<E, S: Encoder<E>> Encodable<S, E> for ConfigValue {
         match *self {
             String(ref string, _) => string.encode(s),
             List(ref list) => {
-                let list: Vec<&String> = list.iter().map(|s| s.ref0()).collect();
+                let list: Vec<&string::String> = list.iter().map(|s| s.ref0()).collect();
                 list.encode(s)
             }
             Table(ref table) => table.encode(s),
@@ -189,7 +191,7 @@ impl ConfigValue {
         }
     }
 
-    pub fn table(&self) -> CargoResult<&HashMap<String, ConfigValue>> {
+    pub fn table(&self) -> CargoResult<&HashMap<string::String, ConfigValue>> {
         match *self {
             Table(ref table) => Ok(table),
             _ => Err(internal(format!("expected a table, but found a {}",
@@ -197,7 +199,7 @@ impl ConfigValue {
         }
     }
 
-    pub fn list(&self) -> CargoResult<&[(String, Path)]> {
+    pub fn list(&self) -> CargoResult<&[(string::String, Path)]> {
         match *self {
             List(ref list) => Ok(list.as_slice()),
             _ => Err(internal(format!("expected a list, but found a {}",
@@ -240,7 +242,7 @@ pub fn get_config(pwd: Path, key: &str) -> CargoResult<ConfigValue> {
         human(format!("`{}` not found in your configuration", key)))
 }
 
-pub fn all_configs(pwd: Path) -> CargoResult<HashMap<String, ConfigValue>> {
+pub fn all_configs(pwd: Path) -> CargoResult<HashMap<string::String, ConfigValue>> {
     let mut cfg = Table(HashMap::new());
 
     try!(walk_tree(&pwd, |mut file| {
@@ -325,7 +327,7 @@ pub fn set_config(cfg: &Config, loc: Location, key: &str,
         Global => cfg.home_path.join(".cargo").join("config"),
         Project => unimplemented!(),
     };
-    let contents = File::open(&file).read_to_string().unwrap_or(String::new());
+    let contents = File::open(&file).read_to_string().unwrap_or("".to_string());
     let mut toml = try!(cargo_toml::parse(contents.as_slice(), &file));
     toml.insert(key.to_string(), value.into_toml());
     try!(File::create(&file).write(toml::Table(toml).to_string().as_bytes()));
index fe5c6c04fcd52391ed9ddc936e01dde80abf7c1d..d0723b3711ce0111295cef3700a2005e7d8b02ae 100644 (file)
@@ -144,7 +144,7 @@ pub fn to_manifest(contents: &[u8],
     }
 }
 
-pub fn parse(toml: &str, file: &Path) -> CargoResult<toml::Table> {
+pub fn parse(toml: &str, file: &Path) -> CargoResult<toml::TomlTable> {
     let mut parser = toml::Parser::new(toml.as_slice());
     match parser.parse() {
         Some(toml) => return Ok(toml),
@@ -538,7 +538,7 @@ fn process_dependencies<'a>(cx: &mut Context<'a>, dev: bool,
 struct TomlTarget {
     name: String,
     crate_type: Option<Vec<String>>,
-    path: Option<TomlPath>,
+    path: Option<TomlPathValue>,
     test: Option<bool>,
     doctest: Option<bool>,
     bench: Option<bool>,
@@ -548,7 +548,7 @@ struct TomlTarget {
 }
 
 #[deriving(Decodable, Clone)]
-enum TomlPath {
+enum TomlPathValue {
     TomlString(String),
     TomlPath(Path),
 }
@@ -569,7 +569,7 @@ impl TomlTarget {
     }
 }
 
-impl TomlPath {
+impl TomlPathValue {
     fn to_path(&self) -> Path {
         match *self {
             TomlString(ref s) => Path::new(s.as_slice()),
@@ -578,7 +578,7 @@ impl TomlPath {
     }
 }
 
-impl fmt::Show for TomlPath {
+impl fmt::Show for TomlPathValue {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         match *self {
             TomlString(ref s) => s.fmt(f),